package com.hermit.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hermit.system.dao.UserStudentDao;
import com.hermit.system.dto.UserStudentDTO;
import com.hermit.system.entity.UserStudentEntity;
import com.hermit.system.service.UserStudentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userStudentService")
public class UserStudentServiceImpl extends ServiceImpl<UserStudentDao, UserStudentEntity> implements UserStudentService {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 查询数据库所有表
     */
    public List<UserStudentDTO> queryAll() {
        List<UserStudentDTO> allDataList = baseMapper.queryAll();
        System.out.println("查询结果:" + allDataList);
        return allDataList;
    }

    /**
     * 删除
     */
    public void delete(int id) {
        UserStudentEntity userStudentEntity = baseMapper.selectById(id);
        userStudentEntity.setDeleteFlag(1);
        baseMapper.updateById(userStudentEntity);
    }
}